using System.ComponentModel.DataAnnotations;
using InputBuilder.Attributes;
using Tools.Common.Reflection;
using Web.App.Infrastructure.Interface;
using Webshop20.Application.Queries.Messages;

namespace Webshop20.Presentation
{
    public class LoginForm
    {
        private readonly string userName;
        private readonly string password;
        private string targetController;
        private string targetAction;

        [PartialView("Hidden")]
        public string TargetAction
        {
            get { return targetAction; }
            
        }

        [PartialView("Hidden")]
        public string TargetController
        {
            get { return targetController; }
            
        }

        [Required]
        [Label("Passwort")]
        public string Password
        {
            get { return password; }
        }

        [Required]
        [Label("Benutzername")]
        public string UserName
        {
            get { return userName; }
            
        }


        public string UserNameFieldName()
        {
            return ReflectAbout<LoginRequest>.GetProperty(x => x.UserName).Name; 
        }

        public string PasswordFieldName()
        {
            return ReflectAbout<LoginRequest>.GetProperty(x => x.Password).Name; 
        }

        public string TargetControllerFieldName()
        {
            return ReflectAbout<ControllerRedirect>.GetProperty(x => x.ControllerName).Name; 
        }

        public string TargetActionFieldName()
        {
            return ReflectAbout<ControllerRedirect>.GetProperty(x => x.ControllerAction).Name; 
        }

        public LoginForm(string userName, string password, string targetController, string targetAction)
        {
            this.userName = userName;
            this.targetAction = targetAction;
            this.targetController = targetController;
            this.password = password;
        }


    }
}